#pragma once
#include "zuc/nml_intf/zucpos.h"

// 这里的接口，涉及到配置文件的改动

// 关节安全参数
extern int zucJointSetMinPositionLimit(int robot_id, int joint, double limit);
extern int zucJointSetMaxPositionLimit(int robot_id, int joint, double limit);
extern int zucSetJointSafety(int robot_id, int jointNum, int paramType, float jointVelLimit, float jointErrLimit);
extern int zucJointSetMaxVelocity(int robot_id, int joint, double vel);
extern int zucJointSetErrLimit(int robot_id, int joint, double err_limit);

// 整机安全位置
extern int zucSetCustomPose(int robot_id, int type, const double* jointPos);
extern int zucSetCustomPoseTol(int robot_id, double tol);
extern int zucSetHomeVel(int robot_id, double vel);

// 整机碰撞参数
extern int zucSetCollisionSensitivity(int robot_id, const int* joint_sensitivity);
extern int zucSetForceLimitValue(int robot_id, int force_limit_value);
extern int zucSetCollisionDetectionEnable(int robot_id, int collision_detection_enable);

// 整机伺服模式参数
extern int zucSetServoMoveFilterType(int robot_id, int filterType);
extern int zucSetServoMoveMMFParam(int robot_id, int maxSize, double ka, double kv, double kp);
extern int zucSetServoMoveNLFParamC(int robot_id, double vp, double ap, double jp, double vr, double ar, double jr);
extern int zucSetServoMoveNLFParamJ(int robot_id, double vr, double ar, double jr);
extern int zucSetServoMoveLPFParam(int robot_id, double cutoffFreq);
extern int zucSetServoMoveLAVSParamC(int robot_id, int maxSize, double kp);  // lookahead vel smooth in Cartesian

// 整机力控参数
extern int zucTrajSetAdmittanceConfig(int robot_id, int axis, FtConfig ftConfig, int immediate);
extern int zucTrajSetAdmittanceCtrlFrame(int robot_id, int ftFrame);
extern int zucAdmittanceDragDeadZone(int robot_id, const double* dead_zone);
extern int zucTorqueSensorSoftLimit(int robot_id, const double* limit);
extern int zucTorqueSensorFilter(int robot_id, double torqueSensorFilter);
extern int zucTrajSetComplianceInit(int robot_id, int compliantType, int compliantEnable);

// 坐标系相关
extern int zucSetGravityDirection(int robot_id, const double* rpy);

// 拖拽相关
extern int zucSetDragControlEnable(int robot_id, int drag_control_enable);
extern int zucSetDragControlFcCompensate(int robot_id, const int* drag_control_fc_compensate);
extern int zucSetDragControlFvCompensate(int robot_id, const int* drag_control_fv_compensate);
extern int zucSetDragControlFilterFactor(int robot_id, const int* drag_control_filter_factor);
extern int zucSetDragControlDitherFactor(int robot_id, const double* drag_control_dither_factor);

// 辨识相关
extern int zucSetPayloadIdentifyTrajStartPos(int robot_id, int trajId, JointTraj jointTraj);
extern int zucSetPayloadIdentifyTrajEndPos(int robot_id, int trajId, JointTraj jointTraj);
extern int zucSetIdentifyFrictionEndPos(int robot_id, int friction_identify_joint_index, const double* friction_identify_end_pos);
extern int zucSetIdentifyFrictionStartPos(int robot_id, int friction_identify_joint_index, const double* friction_identify_start_pos);
extern int zucSetIdentifyCycleTime(int robot_id, int identify_cycle_time);

// 自动运行相关
extern int zucSetRobotName(int robot_id, const char* name);
extern int zucSetupScriptBackup(int robot_id, int enable, double interval);
extern int zucTaskSetAutoWork(int robot_id, int enable, const char* file);

// TIO相关
extern int zucSetTioRs485SigProgStat(int robot_id, const char* sig_name, int prog_stat);
extern int zucTioMBAddSignal(int robot_id, const char* name, int chnId, unsigned int type, unsigned int addr);
extern int zucTioSetupRS485ChnMode(int robot_id, int chnId, int mode);
extern int zucTioSetupRS485ChnComm(int robot_id, int chnId, ModRtuComm& rtuComm);
extern int zucTioSetPinMode(int robot_id, int type, int mode);
extern int zucTioSetVoutEnable(int robot_id, int enable);
extern int zucTioSetVoutVoltage(int robot_id, int volCfg);
extern int zucMotionFreeButtonOpt(int robot_id, bool freeButtonOpt);
extern int zucMotionFreeProgButtonOpt(int robot_id, bool freeButtonOpt, bool progButtonOpt);
extern int zucMotionPointButtonOpt(int robot_id, bool pointButtonOpt);

extern int zucTorqSensorSetComm(int robot_id, int commType, CommInfo commCfg);
extern int zucTorqSensorSetPayload(int robot_id, Payload payload);
extern int zucTorqSensorSetMode(int robot_id, int mode);
extern int zucTorqSensorSetBrand(int robot_id, int torqsensorBrand);

extern int zucToolSetPayload(int robot_id, Payload payload);
extern int zucTrajSetPlannerJerk(int robot_id, double joint_jerk, double carte_jerk);
extern int zucOneKeyOp(int robot_id, int autoenable, int autoprogram);
extern int zucSetupIOChannel(int robot_id, int type, int index, int setting);
extern int zucSetBRStartVoltage(int robot_id, int start_voltage);

extern int zucSetCollisionOption(int robot_id,
                                 int reactionType,
                                 double reboundAngle,
                                 double reboundLength,
                                 double rebound_j_acc,
                                 double rebound_j_vel,
                                 double rebound_l_acc,
                                 double rebound_l_vel,
                                 int collisionMethod);
